home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The PC-SIG Library 10
/
The PC-Sig Library - Shareware for the IBM PC and Compatibles (PC-SIG)(Tenth Edition Disks 1-2804)(1991).iso
/
PC_SIGCD
/
04
/
1
/
DISK0413.ZIP
/
BWVID.ASM
< prev
next >
Wrap
Assembly Source File
|
1985-05-17
|
9KB
|
176 lines
;**************************************************************************
; The following is an Interrupt/Stay resident program that intercepts all
; BIOS video calls involving color and maps them to black and white calls.
; It will eliminate many of the fuzzy screens that arise from having
; a BW monitor hooked up to a color graphics board.
; THIS PROGRAM IS ONLY USEFUL IF YOU HAVE A BLACK AND WHITE HIGH RESOLUTION
; MONITOR CONNECTED TO YOUR GRAPHICS CARD.
;
; PROBLEMS THAT THIS ROUTINE SOLVES:
; This program, when installed will remove all the fuzzy displays that
; result when color display instructions are sent to BW monitor through
; the BIOS system. The VAST MAJORITY of available code does go through
; BIOS so this will catch most of those problems. This program works
; as follows:
; Force mode to 40x25 BW if BIOS call is for 40x25 color
; Force mode to 80x25 BW if BIOS call is for 80x25 color
; Force mode to 320x200 BW if BIOS call is for 320x200 color
; Intercepts BIOS calls to write attributes and characters and changes
; them in such a way that:
; * If forground is any color except black then it is forced to white
; * If background is any color except white then it is forced to black
; Intercepts BIOS graphic calls to set the palette and changes them such that:
; * Background is always black
; * Forground is always white
; The "Write Dot" and "Write Teletype" intercept functions both map fore-
; ground to white, regardless of the intended color.
;
; PROBLEMS THAT THIS ROUTINE CREATES:
; When information is transmitted to the view SOLELY through color
; information, then that information is lost in this transformation.
; (naturally!). So if, for example, a game has a color bar that switches
; from green to red to signify danger, that information will be lost.
; This is because generally all forground colors are forced to white and
; all background colors are forced to black. This is not so much a
; problem created by this program as it is a problem with Black and White
; monitors not conveying as much information as Color Monitors.
;
; PROBLEMS THAT THIS ROUTINE DOES NOTHING ABOUT:
; Any video calls that go straight to the hardware instead of going
; through BIOS. It is unfortunately the case that some VERY sophisticated
; programs that really have snazzy graphics do go to the hardware directly
; because of the speed benefits.
;
; After installing this program, all of the IBM Diagnostic tests look
; reasonable.
;
; When loaded this program uses 226 Decimal bytes of memory (It relocates
; itself down into the unused portion of the Program Segment Prefix
; to save memory)
;
; Written 5/02/85 by:
; Scott W. Killen
; P.O Box 27012
; Austin Texas 78705
; CIS ID: 76703,734
;
; This program is GiveAware! The only payment I ask is your comments and
; bug reports.
;**************************************************************************
white MACRO reg ; Force register to have white color code
LOCAL continue ; if not backgound.
MOV AH,0FCH ; Get ready for masking high bits
AND AH,reg ; Save High order bits
AND reg,03H ; test for foreground or background
JZ continue ; If background then we are finished
OR reg,03H ; Force to white forground
continue: OR reg,AH ; Recombine the two parts
ENDM
CSEG SEGMENT
ASSUME CS:CSEG
ORG 100H
CODESTART EQU 5CH
BWVID PROC NEAR
JMP initialize
entry_point:
test0: CMP AH,00H ; Is this set mode?
JNE test11 ; If not then try other test
CMP AL, 03H ; Check if Alpha Mode
JG test0a ; Jump if not Alpha mode
AND AL, 02H ; Force black and white display
JMP continue0 ;
test0a: CMP AL, 05H ; Check for Medium Res Graphics
JG continue0 ; Jump if not Medium Res Graphics
MOV AL, 05H ; Force black and white graphics
EXTRN DOS_RETURN:FAR
continue0: JMP DOS_RETURN ; This code is modified in line!
; Go to normal bios handling.
test11: CMP AH,0BH ; Is this the Set Palatte instruction
JNE test9 ; if not, then continue
CMP BH, 0 ; Is background color being set?
JNZ test11a ; if not go to set forground color set
MOV BL, 0 ; Background color is always black
JMP continue11
test11a: MOV BL,01H ; Foreground color should include set with White
continue11: JMP DOS_RETURN ; This code is modified in line!
test9: CMP AH,09H ; Is this a Write Character and Attribute
JNE test14 ; if not then try next test
MOV AH,BL ; Use the AH register for a minute
AND BL,07H ; Test for some foreground color
JZ test9a ; Jump if foreground is black
OR AH,07H ; Force foreground to white
test9a: MOV BL,AH ; Restore BL to old value with appropriate foreground
AND BL,70H ; Test for background color
XOR BL,70H ; Is it white?
JZ test9b ; Jump if background color is white
AND AH,8FH ; Force background to black
test9b: MOV BL,AH ; Ok set BL to corrected value
MOV AH,09H ; Restore AH and return to BIOS
continue9: JMP DOS_RETURN ; This code is modified in line!
test14: CMP AH,0EH ; Test for write teletype routine
JNE test12 ; Ok, proceed
WHITE BL ; Force forground (if any) to white
MOV AH,0EH ; Restore function code
continue14: JMP DOS_RETURN
test12: CMP AH,0CH ; Is this the write dot routine?
JNE continue12 ; if not then continue
WHITE AL ; Force the color (if any) to white
MOV AH,0CH ; Now restore function code
continue12: JMP DOS_RETURN
initialize:
PUSH DS ; Save DS for later use
XOR AX,AX ; Clear AX
MOV DS,AX ; Prepare to save original interrupt
MOV AX,40H
;
MOV SI,AX ; Source for INT 10h as provided for in the interrupt table
MOV DI, offset [continue0+1] ; Destination in the code segment for moving this pointer
MOVSW ; Move the two word address
MOVSW
MOV SI,AX ; Source for INT 10h as provided for in the interrupt table
MOV DI, offset [continue9+1] ; Destination in the code segment for moving this pointer
MOVSW ; Move the two word address
MOVSW
MOV SI,AX ; Source for INT 10h as provided for in the interrupt table
MOV DI, offset [continue11+1] ; Destination in the code segment for moving this pointer
MOVSW ; Move the two word address
MOVSW
MOV SI,AX ; Source for INT 10h as provided for in the interrupt table
MOV DI, offset [continue12+1] ; Destination in the code segment for moving this pointer
MOVSW ; Move the two word address
MOVSW
MOV SI,AX ; Source for INT 10h as provided for in the interrupt table
MOV DI, offset [continue14+1] ; Destination in the code segment for moving this pointer
MOVSW ; Move the two word address
MOVSW
;
MOV AX,CODESTART ; Fill AX with starting point
MOV [SI-04H],AX ; Move offset in line
MOV [SI-02H],CS ; Move segment value in line
;
POP DS ; Restore the data segment
MOV CX, offset initialize ; These lines relocate the interrupt
SUB CX, offset entry_point ; handler down into the unused
MOV DI, CODESTART ; portion of the Program Segment
MOV SI, offset entry_point ; Prefix (to save memory)!
REP MOVSB ;
;
MOV DX, offset initialize ; Top of code address
SUB DX, offset entry_point ; Width of code
ADD DX, CODESTART ; Bias by starting address
INT 27H ; Terminate but stay resident
BWVID ENDP
CSEG ENDS
END BWVID